<?php
// 应用公共文件
//普通场景
if(!function_exists('responses')){
    function responses($data,$msg,$code){
        return json([
            'data'=>$data,
            'msg'=>$msg,
            'code'=>$code
        ]);
    }
}

//成功返回值
if(!function_exists('succeed')){
    function succeed($data=[],$msg='',$code=200){
        return responses($data,$msg,$code);
    }
}

//失败返回值
if(!function_exists('fail')){
    function fail($data=[],$msg='',$code=500){
        return responses($data,$msg,$code);
    }
}

//为密码加盐加密
if(!function_exists('encrypt_password')){
    function encrypt_password($password){
        $salt='iwehnseefosd/.';
        return trim(trim(md5($password),$salt));
    }
}